<!DOCTYPE html>
<html lang="en">

<head>
    <meta charset="UTF-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>Document</title>
    <!-- 1. 导入css -->
    <link rel="stylesheet" href="./bootstrap/bootstrap.min.css">
</head>

<body>
    <!-- Button trigger modal -->
    <button type="button" class="btn btn-danger" 
    data-bs-toggle="modal" 
    data-bs-target="#exampleModal11"
    >
       打开模态框
    </button>

    <!-- 准备模态框 -->
    <div class="modal fade" id="exampleModal" tabindex="-1" aria-labelledby="exampleModalLabel" aria-hidden="true">
        <div class="modal-dialog">
          <div class="modal-content">
            <div class="modal-header">
              <h1 class="modal-title fs-5" id="exampleModalLabel">Modal title</h1>
              <button type="button" class="btn-close" data-bs-dismiss="modal" aria-label="Close"></button>
            </div>
            <div class="modal-body">
              ...
            </div>
            <div class="modal-footer">
              <button type="button" class="btn btn-secondary" data-bs-dismiss="modal">Close</button>
              <button type="button" class="btn btn-primary">Save changes</button>
            </div>
          </div>
        </div>
      </div>


    <script src="./bootstrap/bootstrap.min.js"></script>
    <script>
        const myModal = new bootstrap.Modal(document.getElementById('exampleModal'))
        // 打开模态框
        myModal.show()

        setTimeout(() => {
            myModal.hide() //关闭模态框
        }, 1000);

    </script>
</body>

</html>